package model.route;

import java.io.Serializable;

import model.mapping.MapPoint;

public class AstarNode implements Comparable<AstarNode>,Serializable  {
	
	private MapPoint point;
	private int f;
	private int g;
	private int h;
	private AstarNode father;
	
	public AstarNode(MapPoint mpoint,int g,int h,AstarNode father) {
		
		this.point = mpoint;
		this.g = g;
		this.h = h;
		this.father = father;
		this.f = this.g + this.h;
	}

	public MapPoint getPoint() {
		return point;
	}

	public void setPoint(MapPoint point) {
		this.point = point;
	}

	public int getF() {
		return f;
	}

	public void setF(int f) {
		this.f = f;
	}

	public int getG() {
		return g;
	}

	public void setG(int g) {
		this.g = g;
	}

	public int getH() {
		return h;
	}

	public void setH(int h) {
		this.h = h;
	}

	public AstarNode getFather() {
		return father;
	}

	public void setFather(AstarNode father) {
		this.father = father;
	}
	
	public int compareTo(AstarNode node) {
		
		if (f > node.getF()) return 1;
        else if (f < node.getF()) return -1;
        else return 0;
	}
}
